﻿using System;

using System.Collections.Generic;
using System.Text;
using Silvermoon.Windows;

namespace Silvermoon.Controls
{
    /// <summary>
    /// EventArgs which are used for command bubbling. 
    /// </summary>
    public class CommandEventArgs : CancelEventArgs
    {
        /// <summary>
        /// Gets the Command that is raised.
        /// </summary>
        public ICommand Command { get; private set; }

        /// <summary>
        /// Gets the control which originally fired the command.
        /// </summary>
        public Control Owner { get; private set; }

        /// <summary>
        /// Gets the control which sent the event.
        /// </summary>
        public Control Sender { get; set; }

        /// <summary>
        /// Optionally custom data which can be set while bubbling or any other place.
        /// </summary>
        public object Object { get; set; }

        /// <summary>
        /// Initializes a new instance of the <see cref="CommandEventArgs"/> class.
        /// </summary>
        /// <param name="command">The command.</param>
        /// <param name="owner">The owner who fired the event.</param>
        public CommandEventArgs(ICommand command, Control owner)
            : base()
        {
            this.Command = command;
            this.Sender = owner;
            this.Owner = owner;
        }
    }
}
